<template>
	<el-dialog :visible.sync="dialogVisible" :title="title" :close-on-click-modal="false" width="80%" append-to-body>
		<iframe :src="url" v-if="url!=''" width="100%" height="800px"></iframe>
		<el-empty  v-if="url==''"description="文件路径正确或不支持的格式!"></el-empty>
		</el-dialog>
</template>

<script>
	import axios from 'axios';
	import pdf from 'vue-pdf';
	export default {
		components:{
			pdf
		},
		data(){
			return{
				title:'文档预览',
				url:'',
				dialogVisible:false,
			}
		},
		methods:{
			initData(data){
				if(data.url==""){
					this.title="预览异常";
				}else{
					this.url=axios.default.pdfViewerURL+"?file="+data.url;
					this.title="文档预览("+data.name+")";
				}
 			}
		}
	}
</script>

<style>
</style>
